﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
  public class WorkflowInstanceAdaptor : Adaptor, IDeletable
  {
    private WorkflowInstance wfInstance;
    public WorkflowInstanceAdaptor(WorkflowInstance wfInstance)
    {
      this.wfInstance = wfInstance;
    }

    public override string Text
    {
      get 
      {
        return wfInstance.Guid.ToString(); 
      }
    }

    public override object Object
    {
      get 
      {
        return wfInstance; 
      }
    }

    public override int ImageIndex
    {
      get
      {
        return 9;
      }
    }

    public override Control GetRenderer()
    {
      WorkflowInstanceControl control = new WorkflowInstanceControl();
      control.LoadWorkflowInstance(wfInstance);
      control.ItemDeleted += new EventHandler(TriggerItemDeleted);
      return control;
    }

    #region IDeletable Members

    public void Delete()
    {
      wfInstance.Delete();
    }

    #endregion
  }
}
